// 桥接模式
typedef struct _CPU {
    void (*assemble_cpu_imp)( struct _CPU* cpu );
    int type;
} CPU;
 
static void assemble_cpu_imp( CPU *cpu )
{
    printf( "%d cpu!\n", cpu->type );
}
 
typedef struct _Computer {
    void (*assemble_cpu)( CPU *cpu );
} Computer;
 
static void assemble_cpu( CPU *cpu )
{
    cpu->assemble_cpu_imp( cpu );
}
 
#define LOWEND_TYPE 0x01
#define HIGHEND_TYPE  0x02
int main( void )
{
    CPU cpu1;
    cpu1.type = LOWEND_TYPE;
    cpu1.assemble_cpu_imp = assemble_cpu_imp;
    CPU cpu2;
    cpu2.type = HIGHEND_TYPE;
    cpu2.assemble_cpu_imp = assemble_cpu_imp;
 
    Computer com1;
    com1.assemble_cpu = assemble_cpu;
    com1.assemble_cpu( &cpu1 );
    com1.assemble_cpu( &cpu2 );
 
    Computer com2;
    com2.assemble_cpu = assemble_cpu;
    com2.assemble_cpu( &cpu1 );
    com2.assemble_cpu( &cpu2 );
}